import request from '@/utils/request'

export function getUserList(params) {
  return request({
    url: '/admin/users/',
    method: 'get',
    params
  })
}

export function getBlackList(params) {
  return request({
    url: '/admin/agency/blacklist/',
    method: 'get',
    params
  })
}

export function deleteUser(id) {
  return request({
    url: `/admin/users/${id}/`,
    method: 'delete'
  })
}

export function getUserDetail(id) {
  return request({
    url: `/admin/users/${id}/`,
    method: 'get'
  })
}

export function editUserDetail(data, id) {
  return request({
    url: `/admin/users/${id}/`,
    method: 'put',
    data
  })
}

export function saveAddUser(data) {
  return request({
    url: `/admin/users/`,
    method: 'post',
    data
  })
}

export function getRoleList(params) {
  return request({
    url: '/admin/roles/',
    method: 'get',
    params
  })
}

export function getRoleDetail(id) {
  return request({
    url: `/admin/roles/${id}/`,
    method: 'get'
  })
}

export function getPermissions() {
  return request({
    url: `/admin/permissions/`,
    method: 'get'
  })
}

export function editRoleDetail(data, id) {
  return request({
    url: `/admin/roles/${id}/`,
    method: 'put',
    data
  })
}

export function saveAddRole(data) {
  return request({
    url: `/admin/roles/`,
    method: 'post',
    data
  })
}

export function getReportList(params) {
  return request({
    url: '/admin/agency/get_agency_stats_report/',
    method: 'get',
    params
  })
}
export function getInnerReportList(params) {
  return request({
    url: '/admin/agency/get_inner_agency_stats_report/',
    method: 'get',
    params
  })
}

export function getDailyReportList(params) {
  return request({
    url: '/admin/agency/agency_daily_report/',
    method: 'get',
    params
  })
}

export function getCpsdata(params) {
  return request({
    url: '/external/cps/',
    method: 'get',
    params
  })
}

export function getMerchantsList(params) {
  return request({
    url: '/admin/mch/',
    method: 'get',
    params
  })
}

export function getRecordList(params) {
  return request({
    url: '/admin/record/',
    method: 'get',
    params
  })
}

export function saveMerchants(data) {
  return request({
    url: `/admin/mch/`,
    method: 'post',
    data
  })
}

export function getMerchantsDetail(id) {
  return request({
    url: `/admin/mch/${id}/`,
    method: 'get'
  })
}

export function deleteMerchant(id) {
  return request({
    url: `/admin/mch/${id}/`,
    method: 'delete'
  })
}

export function updateMerchant(data, id) {
  return request({
    url: `/admin/mch/${id}/`,
    method: 'put',
    data
  })
}


export function getAgencyList(params) {
  return request({
    url: '/admin/agency/',
    method: 'get',
    params
  })
}

export function saveAgency(data) {
  return request({
    url: `/admin/agency/`,
    method: 'post',
    data
  })
}

export function getAgencyDetail(id) {
  return request({
    url: `/admin/agency/${id}/`,
    method: 'get'
  })
}

export function deleteAgency(id) {
  return request({
    url: `/admin/agency/${id}/`,
    method: 'delete'
  })
}

export function updateAgency(data, id) {
  return request({
    url: `/admin/agency/${id}/`,
    method: 'put',
    data
  })
}

export function resetAgencyPassword(id) {
  return request({
    url: `/admin/agency/reset_password/${id}/`,
    method: 'put',
  })
}

export function getBulletinList(params) {
  return request({
    url: '/admin/sys/bulletin/',
    method: 'get',
    params
  })
}

export function saveBulletin(data) {
  return request({
    url: `/admin/sys/bulletin/`,
    method: 'post',
    data
  })
}

export function getBulletinDetail(id) {
  return request({
    url: `/admin/sys/bulletin/${id}/`,
    method: 'get'
  })
}

export function deleteBulletin(id) {
  return request({
    url: `/admin/sys/bulletin/${id}/`,
    method: 'delete'
  })
}

export function updateBulletin(data, id) {
  return request({
    url: `/admin/sys/bulletin/${id}/`,
    method: 'put',
    data
  })
}

export function getReceiptConfList(params) {
  return request({
    url: '/admin/agency/receipt_conf/',
    method: 'get',
    params
  })
}

export function updateReceiptConf(data, id) {
  return request({
    url: `/admin/agency/receipt_conf/${id}/`,
    method: 'put',
    data
  })
}

export function getAgencyReceiptList(params) {
  return request({
    url: '/admin/agency/receipt_addresses/',
    method: 'get',
    params
  })
}

export function saveAgencyReceipt(data) {
  return request({
    url: `/admin/agency/receipt_addresses/`,
    method: 'post',
    data
  })
}

export function getAgencyReceiptDetail(id) {
  return request({
    url: `/admin/agency/receipt_addresses/${id}/`,
    method: 'get'
  })
}

export function deleteAgencyReceipt(id) {
  return request({
    url: `/admin/agency/receipt_addresses/${id}/`,
    method: 'delete'
  })
}

export function disabledAgencyReceipt(data, id) {
  return request({
    url: `/admin/agency/receipt_addresses/${id}/status/`,
    method: 'put',
    data
  })
}

export function updateAgencyReceipt(data, id) {
  return request({
    url: `/admin/agency/receipt_addresses/${id}/`,
    method: 'put',
    data
  })
}

export function getAgencyRechargeList(params) {
  return request({
    url: '/admin/agency/recharge_order/',
    method: 'get',
    params
  })
}

export function agreeAgencyRecharge(id, data) {
  return request({
    url: `/admin/agency/recharge_order/${id}/agree/ `,
    method: 'put',
    data
  })
}

export function refuseAgencyRecharge(id, data) {
  return request({
    url: `/admin/agency/recharge_order/${id}/refuse/ `,
    method: 'put',
    data
  })
}

//追回代理申请额度
export function chaseAgencyRecharge(id, data) {
  return request({
    url: `admin/agency/recharge_order/${id}/chase/`,
    method: 'put',
    data
  })
}

export function getFeaturesConfig(params) {
  return request({
    url: '/admin/sys/features_config/ ',
    method: 'get',
    params
  })
}

export function getPlayerOrderList(params) {
  return request({
    url: '/admin/orders/',
    method: 'get',
    params
  })
}

export function enbleAgentMag(id) {
  return request({
    url: `/admin/agency/${id}/enable/ `,
    method: 'put'
  })
}

export function openAgentMag(id) {
  return request({
    url: `/admin/agency/${id}/disable/ `,
    method: 'put'
  })
}

//聊天相关-获取聊天信息
export function getChatInfo(params) {
  return request({
    url: '/admin/im/topics/',
    method: 'get',
    params
  })
}


//玩家订单-获取订单列表
export function getInnerOrders(params) {
  return request({
    url: '/admin/orders/inner_order/',
    method: 'get',
    params
  })
}
//玩家订单-获取订单列表
export function getOrders(params) {
  return request({
    url: '/admin/orders/',
    method: 'get',
    params
  })
}

//玩家订单追分
export function appendScor(id, data) {
  return request({
    url: `/admin/orders/${id}/chase/`,
    method: 'put',
    data
  })
}

export function getBulletin() {
  return request({
    url: `/agency/sys/bulletin/`,
    method: 'get',

  })
}

//获取投诉列表
export function getComplaintList(params) {
  return request({
    url: '/admin/agency/complain/',
    method: 'get',
    params
  })
}

//通过ID获取投诉详情
export function getComplainById(id) {
  return request({
    url: `/admin/agency/complain/${id}/`,
    method: 'get'
  })
}

//通过ID回复投诉
export function replyComplainById(id, data) {
  return request({
    url: `/admin/agency/complain/handle/${id}/`,
    method: 'put',
    data
  })
}

//获取订单评价
export function getOrderEvaluation(params) {
  return request({
    url: '/admin/orders/comment/',
    method: 'get',
    params
  })
}

//启用商户
export function enableMch(id) {
  return request({
    url: `/admin/mch/${id}/enable/`,
    method: 'put'
  })
}

//禁用商户
export function disableMch(id) {
  return request({
    url: `/admin/mch/${id}/disable/`,
    method: 'put'
  })
}

//获取聊天记录
export function getIMInfoByTopicId(topicId) {
  return request({
    url: `/admin/im/topics/${topicId}/messages/`,
    method: 'get'
  })
}

export function getImInfoByLastInfoId(topicId, params) {
  return request({
    url: `/admin/im/topics/${topicId}/messages/`,
    method: 'get',
    params
  })
}


//修改个人密码
export function resetMyPassword(data) {
  return request({
    url: '/admin/reset_password/',
    method: 'put',
    data
  })
}

//重置密码
export function resetPassword(id) {
  return request({
    url: `/admin/reset_password/${id}/`,
    method: 'put'
  })
}

//获取当前登陆账号是否评价订单状态
export function getUserOrderConfig() {
  return request({
    url:'admin/sys/order_comment_conf/',
    method:'get'
  })
}

//修改当前登陆账号是否评价订单状态
export function setUserOrderConfig(data) {
  return request({
    url:'admin/sys/order_comment_conf/',
    method:'put',
    data
  })
}

export function exportExel(id) {
  return request({
    url:`admin/sys/export_task/${id}/`,
    method:'get'
  })
}

export function getQiniuUploadToken() {
  return request({
      url: '/utils/get_upload_token/',
      method: 'get',
  })
}

export function qiniuUpload(data) {
  return request({
      url: `http://up-z1.qiniup.com/`,
      method: 'post',
      data
  })
}


export function getImTopic(params) {
  return request({
    url:`admin/im/topics/messages/`,
    method:'get',
    params
  })
}